﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;

namespace IDELauncher
{
    public partial class SplashWindow : Form
    {
        Process proc;

        private Semaphore s;

        public SplashWindow()
        {
            InitializeComponent();
        }

        public SplashWindow(Semaphore s)
        {
            this.s = s;
            InitializeComponent();
        }

        private void SplashWindow_Load(object sender, EventArgs e)
        {
            Environment.CurrentDirectory = Path.GetDirectoryName(Application.ExecutablePath);

            var info = new ProcessStartInfo("mainapp.exe", "");
            proc = Process.Start(info);

            timer1.Enabled = true;
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (s.WaitOne(15))
                this.Close();
        }

    }
}
